const { Comment } = require('../../model/comment.js');

module.exports = async (req, res) => {
	//获取传递过来的评论
	const { content, aid, uid } = req.body;
	//将数据添加到数据库中
	await Comment.create({
		content: content,
		aid: aid,
		uid: uid,
		time: new Date()
	});
	//重定向回详情页 需把用户id传过去
	res.redirect('/home/article?id=' + aid);
}
